import requests

class DepartmentApi:
  @classmethod
  def organ_list_api(cls,token):
    url = "http://ihrm2-test.itheima.net/api/company/department"
    header = {"Authorization":token}
    resp = requests.get(url=url, headers=header)
    return resp
  @classmethod
  def dep_info_api(cls,token,dep_id):
    url = f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
    header = {"Authorization":token}
    resp = requests.get(url=url, headers=header)
    return resp
  @classmethod
  def add_dep_api(cls,token,add_dep_body):
    url = "http://ihrm2-test.itheima.net/api/company/department"
    header = {"Content-Type": "application/json", "Authorization": token}
    resp = requests.post(url=url, headers=header, json=add_dep_body)
    return resp
  @classmethod
  def modify_dep_api(cls,dep_id,token,modify_dep_body):
    url = f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
    header = {"Content-Type": "application/json", "Authorization": token}
    resp = requests.put(url=url, headers=header, json=modify_dep_body)
    return resp
  @classmethod
  def del_dep_api(cls,dep_id,token):
    url = f"http://ihrm2-test.itheima.net/api/company/department/{dep_id}"
    header = {"Authorization": token}
    resp = requests.delete(url=url, headers=header)
    return resp
